﻿#region Imports
using System;
using System.Windows.Forms;
using CommonUtilities.Events;
using CommonUtilities.Extensions;
using CommonUtilities.Util;
#endregion

namespace CommonUtilities.Controls
{
    /// <summary>
    /// CommonUtilities ComboBox for address
    /// (inherited from System.Windows.Forms.ComboBox)
    /// </summary>
    public class CUtil_AddressComboBox : ComboBox
    {
        #region Declarations
        public new event EventHandler MouseEnter;
        public new event EventHandler MouseLeave;
        #endregion

        #region Constructors
        /// <summary>
        /// Default constructor
        /// </summary>
        public CUtil_AddressComboBox()
        {
            base.MouseEnter += new EventHandler(CUtil_AddressComboBox_MouseEnter);
            base.MouseLeave += new EventHandler(CUtil_AddressComboBox_MouseLeave);
        }
        #endregion

        #region Events
        private void CUtil_AddressComboBox_MouseEnter(object sender, EventArgs e)
        {
            EventList.ComboBox_ShowDropDown(sender, e);

            if (!this.MouseEnter.IsNull())
                this.MouseEnter(sender, e);
        }

        private void CUtil_AddressComboBox_MouseLeave(object sender, EventArgs e)
        {
            EventList.ComboBox_HideDropDown(sender, e);

            if (!this.MouseLeave.IsNull())
                this.MouseLeave(sender, e);
        }
        #endregion

        #region Methods
        public override string ToString()
        {
            return Utilities.ToString(this);
        }
        #endregion
    }
}
